package com.zzxy.spring5.po;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.*;

public class User implements BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean {
    private String username;

    public String getUsername() {
        return username;
    }
    public User(){
        System.out.println("1.init instance");
    }

    public void setUsername(String username) {
        this.username = username;
        System.out.println("2.set property ...");
    }

    @Override
    public void setBeanName(String s) {
        System.out.println("3.set bean name : " + s);
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        System.out.println("5.set bean factory");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("6.init bean");
    }
    public void myInit(){
        System.out.println("7. my init");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("9.destroy ..");
    }
    public void myDestroy(){
        System.out.println("10.my Destroy");
    }
}
